package com.aaa.hospital.controller;

import com.aaa.hospital.aop.Log;
import com.aaa.hospital.pojo.domain.NewsType;
import com.aaa.hospital.pojo.query.NewsTypeQuery;
import com.aaa.hospital.pojo.vo.NewsTypeVO;
import com.aaa.hospital.result.AjaxResult;
import com.aaa.hospital.service.NewsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program:qy888
 * @description:www
 * @author:LJW
 * @version: 1.0
 * @create:2022-2-16 18:54
 */
@RestController
@RequestMapping("type")
public class NewsTypeController {

    @Autowired
    private NewsTypeService newsTypeService;

    @RequestMapping("list")
    public AjaxResult list(){
        return newsTypeService.list();
    }

    @RequestMapping("faburen")
    public AjaxResult faburen(){
        return newsTypeService.faburen();
    }


    @RequestMapping("leixingsousuo")
    public AjaxResult leixingsousuo(NewsTypeQuery newsTypeQuery){
        return  newsTypeService.leixingsousuo(newsTypeQuery);
    }

    @RequestMapping("update")
    @Log("修改新闻类型")
    public AjaxResult update(NewsTypeVO newsTypeVO){
        System.out.println(newsTypeVO);
        return  newsTypeService.update(newsTypeVO);
    }

    @RequestMapping("add")
    @Log("添加新闻类型")
    public AjaxResult add(NewsTypeVO newsTypeVO){
        System.out.println(newsTypeVO);
        return  newsTypeService.add(newsTypeVO);
    }

    @RequestMapping("delete/{id}")
    @Log("删除新闻类型")
    public AjaxResult delete(@PathVariable("id") Integer id){
        System.out.println(id);
        return  newsTypeService.delete(id);
    }

    @RequestMapping("get/{id}")
    public AjaxResult get(@PathVariable("id") Integer id){
        System.out.println(id);
        return  newsTypeService.get(id);
    }


}
